import request from '@/utils/request'

const api = {
  sortList: '/t1/survey/class_list',
  addSort: '/t1/survey/class_add',
  changeStatus: '/t1/survey/class_status_update',
  editSort: '/t1/survey/class_edit',
  surveyAdd: '/t1/survey/add',
  surveyList: '/t1/survey/list',
  surveyEdit: '/t1/survey/edit',
  surveyInfo: '/t1/survey/info',
  surveyDel: '/t1/survey/del',
  questionList: '/t1/survey/question_list',
  questionAdd: '/t1/survey/question_add',
  questionEdit: '/t1/survey/question_edit',
  questionDel: '/t1/survey/question_del',
  answerList: '/t1/survey/answer_list',
  answerInfo: '/t1/survey/answer_info'
}

/**
 * login func
 * parameter: {
 *     username: '',
 *     password: '',
 *     remember_me: true,
 *     captcha: '12345'
 * }
 * @param parameter
 * @returns {*}
 */
// 新建问卷
export function answerInfo (parameter) {
  return request({
    url: api.answerInfo,
    method: 'get',
    params: parameter
  })
}
// 新建问卷
export function answerList (parameter) {
  return request({
    url: api.answerList,
    method: 'get',
    params: parameter
  })
}
// 新建问卷
export function questionList (parameter) {
  return request({
    url: api.questionList,
    method: 'get',
    params: parameter
  })
}
// 新建问卷
export function surveyList (parameter) {
  return request({
    url: api.surveyList,
    method: 'get',
    params: parameter
  })
}
// 新建问卷
export function surveyInfo (parameter) {
  return request({
    url: api.surveyInfo,
    method: 'get',
    params: parameter
  })
}
// 新建问卷
export function questionDel (parameter) {
  return request({
    url: api.questionDel,
    method: 'post',
    data: parameter
  })
}
// 新建问卷
export function questionAdd (parameter) {
  return request({
    url: api.questionAdd,
    method: 'post',
    data: parameter
  })
}
// 新建问卷
export function questionEdit (parameter) {
  return request({
    url: api.questionEdit,
    method: 'post',
    data: parameter
  })
}
// 新建问卷
export function surveyDel (parameter) {
  return request({
    url: api.surveyDel,
    method: 'post',
    data: parameter
  })
}
// 新建问卷
export function surveyEdit (parameter) {
  return request({
    url: api.surveyEdit,
    method: 'post',
    data: parameter
  })
}
// 新建问卷
export function surveyAdd (parameter) {
  return request({
    url: api.surveyAdd,
    method: 'post',
    data: parameter
  })
}

// 获取分类列表
export function sortList (parameter) {
  return request({
    url: api.sortList,
    method: 'get',
    params: parameter
  })
}
// 新增分类
export function addSort (parameter) {
  return request({
    url: api.addSort,
    method: 'post',
    data: parameter
  })
}
// 状态变更
export function changeStatus (parameter) {
  return request({
    url: api.changeStatus,
    method: 'post',
    data: parameter
  })
}
// 编辑分类
export function editSort (parameter) {
  return request({
    url: api.editSort,
    method: 'post',
    data: parameter
  })
}
